package com.example.libary.controller;

import com.example.libary.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试控制器
 */
@Tag(name = "测试接口", description = "用于测试认证和权限")
@RestController
@RequestMapping("/test")
public class TestController {
    
    /**
     * 测试认证
     */
    @Operation(summary = "测试认证", description = "需要登录才能访问")
    @SecurityRequirement(name = "Authorization")
    @GetMapping("/auth")
    public Result<String> testAuth() {
        return Result.success("认证成功，您已成功登录");
    }
    
    /**
     * 无需认证的接口
     */
    @Operation(summary = "公开接口", description = "无需登录即可访问")
    @GetMapping("/public")
    public Result<String> testPublic() {
        return Result.success("这是一个公开接口，无需认证");
    }
} 